package com.itheima.utils;

import java.security.MessageDigest;
import java.util.Base64;

public class MD5Util {

    /**
     * 密码加密
     * @param password
     * @return
     * @throws Exception
     */
    public static String  md5(String password){
        try {
            return Base64.getEncoder().encodeToString(MessageDigest.getInstance("MD5").digest(password.getBytes()));
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }
}
